$(document).ready(function () {
	//variable para hacer las validaciones del email
	var emailreg = /^[a-zA-Z0-9_\.\-]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$/;
	  
	  var vars = [], hash;
      var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('#');
	    for(var i = 0; i < hashes.length; i++) {
	        hash = hashes[i].split('=');
	        vars.push(hash[0]);
	        vars[hash[0]] = hash[1];
	    }
     var user=vars["user"];
	  
	  
	        Parse.$= jQuery; 
		    //Parse.initialize("cIsgepqAZm90F2mWdiJ9nP5HkrdG3nBcs98yJrVA", "CYI3htcqoz9bERjSCTpqu5FOWjhkkl72CgEenoLD");	
		    Parse.initialize("UCyMTCIXJqmFk3oLy4CwkxXv6oymztzqqoQNWAux", "BBYPhajAwBgLFzDTXvnx4MaReUn8Kke2KkwQ4yTT");
		    //Parse.initialize("gLxhWhhBK7SPLZ7Jevs6q2lcLBlhje3l3sQlyS0e", "nPvJsuTXpFeKvNyDjZg8ks8sYwt2nntVOi9hr91J");		   
			var friends = Parse.Object.extend("Friends");
			var query = new Parse.Query(friends);
			query.equalTo("friend1", user);
			query.find({
		  		success: function(results) {
		  		 var s = "</br>";
		  				    
				for(var i=0, len=results.length; i<len; i++) {
					 var f = results[i];
					 s += '<li><a data-role="button" id="lin" class="lin" href="chat.html?user=pepe@gmail.com#!friend=juli@gmail.com&">';
					 s += "<b>"+f.get("friend2")+"</b>";
					 s += "</a></li> ";
				}
				$(".search").append(s);		
				}
				});
	
});
